<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<div>
    <input type="text" v-model="num" placeholder="请输入1-100">
    <input type="button" value="才!" @click="f()">
    <h1>{{info}}</h1>
</div>
<body>
<script src="js/vue.min.js"></script>
<script>
    let x = parseInt(Math.random()*100+1);
    let v = new Vue({
        el:"body>div",
        data:{
            num:"",info:""
        },
        methods:{
            f() {
                if(isNaN(v.num)){
                    v.info="输入错了"
                }else if(v.num>x){
                    v.info="大了";
                }else if(v.num<x){
                    v.info="小了";
                }else {
                    v.info="对了";
                }
            }
        }
    })
</script>
</body>
</html>